package com.it.service;

import com.it.bean.Fruit;
import com.it.dao.FruitDAO;

import java.util.List;

public class FruitServiceImpl implements FruitService {
    public FruitDAO fruitDAO;

    @Override
    public List<Fruit> getFruitList(int page, String queryParem)  throws Exception{
        return fruitDAO.getFruitList(page, queryParem);
    }

    @Override
    public Fruit getFruitByFid(Integer fid) throws Exception {
        return fruitDAO.getFruitByFid(fid);
    }

    @Override
    public void updateFruit(Fruit fruit) throws Exception {
        fruitDAO.updateFruit(fruit);
    }

    @Override
    public void delFruit(Integer fid) throws Exception {
        fruitDAO.delFruit(fid);
    }

    @Override
    public void addFruit(Fruit fruit)  throws Exception{
        fruitDAO.addFruit(fruit);
//        Fruit fruit2 = fruitDAO.getFruitByFid(7);
//        fruit2.setFname("7哈哈哈");
//        fruitDAO.updateFruit(fruit2);
    }

    @Override
    public int getFruitCount(String queryParem)  throws Exception{
        return fruitDAO.getFruitCount(queryParem);
    }
}
